package com.irain.pp.tool.mybatis.mapper;

import org.apache.ibatis.mapping.MappedStatement;
import tk.mybatis.mapper.mapperhelper.MapperHelper;
import tk.mybatis.mapper.provider.base.BaseSelectProvider;

/**
 * @author WangYanPeng
 * @date 2017/10/19 21:00
 */
public class BaseSelectForUpdateProvider extends BaseSelectProvider {

    private static String FOR_UPDATE = " FOR UPDATE";

    public BaseSelectForUpdateProvider(Class<?> mapperClass, MapperHelper mapperHelper) {
        super(mapperClass, mapperHelper);
    }

    public String selectOneForUpdate(MappedStatement ms) {
        return super.selectOne(ms) + FOR_UPDATE;
    }

    public String selectForUpdate(MappedStatement ms) {
        return super.select(ms) + FOR_UPDATE;
    }

    public String selectByPrimaryKeyForUpdate(MappedStatement ms) {
        return super.selectByPrimaryKey(ms) + FOR_UPDATE;
    }

}
